//
//  HelpDetailVC.m
//  
//
//  Created by jiaming yan on 2018/3/15.
//

#import "HelpDetailVC.h"
#import "HelpFullTableViewCell.h"
#import "HelpTableViewCell.h"
#import "PlayVoice.h"

@interface HelpDetailVC ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (strong, nonatomic)  NSMutableArray *arrData;
@property (strong, nonatomic) IBOutlet UIView *topView;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@end

@implementation HelpDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationItem.title = @"求助详情";
    [self loadTabbleView];
    self.contentLabel.text = @"录用通知书有法律效力吗？最近大家比较关注人事方面人事方面的合同问题。面，法大大给大家讲解一下有关录用通知书的人事方面的合同问题...录用通知书有法律效力吗？最近大家比较关注人事方面人事方面的合同问题。面，法大大给大家讲解一下有关录用通知书的人事方面的合同问题...录用通知书有法律效力吗？最近大家比较关注人事方面人事方面的合同问题。面，法大大给大家讲解一下有关录用通知书的人事方面的合同问题...录用通知书有法律效力吗？最近大家比较关注人事方面人事方面的合同问题。面，法大大给大家讲解一下有关录用通知书的人事方面的合同问题...";
    [self.contentLabel sizeToFit];
    self.topView.frame = CGRectMake(0, 0, kScreenWidth, 116+self.contentLabel.mj_h);
    self.tableView.tableHeaderView = self.topView;
}
/*
 方法描述:
 加载列表
 
 参数说明:
 <#参数说明#>
 
 返回结果:
 <#返回结果#>
 
 */
-(void)loadTabbleView{
    [self.tableView registerNib:[UINib nibWithNibName:@"HelpFullTableViewCell" bundle:nil] forCellReuseIdentifier:@"HelpFullTableViewCell"];
    [self.tableView registerNib:[UINib nibWithNibName:@"HelpTableViewCell" bundle:nil] forCellReuseIdentifier:@"HelpTableViewCell"];
    
    self.tableView.tableFooterView = [[UIView alloc]init];
    self.tableView.estimatedRowHeight = 184.0f;
    self.tableView.rowHeight = UITableViewAutomaticDimension;
    if (@available(iOS 11.0, *)) {
        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    } else {
        // Fallback on earlier versions
    }
}
#pragma mark ------tableView代理
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 10;self.arrData.count;
}

//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    return 65;
//}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    
    //    MessageModel *model = self.arrData[indexPath.row];
    //    cell.titleName.text = model.title;
    if (indexPath.row == 0) {
//
        static NSString *identifier = @"HelpFullTableViewCell";
        HelpFullTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
        cell.selectionStyle =  UITableViewCellSelectionStyleNone;
        return cell;
    }else{
        static NSString *identifier = @"HelpTableViewCell";
        HelpTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
        cell.selectionStyle =  UITableViewCellSelectionStyleNone;
        if (indexPath.row %2==0) {
            cell.voiceView.hidden = YES;
            cell.wordView.hidden = NO;
        }else{
            cell.voiceView.hidden = NO;
            cell.wordView.hidden = YES;
        }
        [cell.audioButton addTarget:self action:@selector(voiceButonClick:) forControlEvents:UIControlEventTouchUpInside];
        return cell;
    }

    
    
}
-(void)voiceButonClick:(UIButton *)sender{
    [PlayVoice audioPlayWithUrl:@"http://of7zlfjbb.bkt.clouddn.com/music.mp3"];
    
}

- (void )tableView:(UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath
{

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
